package cn.emove.modular.system.service;


import cn.emove.core.common.page.LayuiPageFactory;
import cn.emove.modular.system.entity.MeterReading;
import cn.emove.modular.system.mapper.MeterReadingMapper;
import cn.emove.modular.system.model.MeterReadingDto;
import cn.stylefeng.roses.core.datascope.DataScope;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Service
public class MeterReadingService extends ServiceImpl<MeterReadingMapper, MeterReading> {
    public Page<Map<String, Object>> selectMeterReadings(DataScope dataScope, String meterNo, String shopName, String shopAdr, String monthTime, String auditStatus, String meterType, String selectFlag, String meterModel) {
        Page page = LayuiPageFactory.defaultPage();
        return this.baseMapper.selectMeterReadings(page,dataScope,meterNo, shopName,shopAdr,monthTime,auditStatus,meterType,selectFlag,meterModel);
    }

    public Integer insertBatch(List<MeterReadingDto> list) {
        return this.baseMapper.insertBatch(list);
    }

    public MeterReadingDto selectDataexist(String month, String meterNo) {
        return this.baseMapper.selectDataexist(month,meterNo);
    }

    public Integer updateBatch(ArrayList<String> array, String status, String remark) {
        return this.baseMapper.updateBatch(array,status,remark);
    }

    public MeterReading selectById(int id) {
        return this.baseMapper.selectById(id);
    }

    public Integer updateOrInsert(MeterReadingDto meterReading) {
        return this.baseMapper.updateOrInsert(meterReading);
    }

    public List<MeterReadingDto> selectDataListexist(String month, String meterNo) {
        return this.baseMapper.selectDataListexist(month,meterNo);
    }
}
